import { request } from "@/api";
import { UserAPI } from "@/api/modules/dwh/user/typings";

/** 此处后端没有提供注释 POST /user/changePassword */
export async function changePassword(body: UserAPI.ChangePasswordParam, options?: { [key: string]: any }) {
  return request<UserAPI.PlainResultboolean>("/user/changePassword", {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    data: body,
    ...(options || {})
  });
}

/** getLoginUserInfo GET /user/getUserInfo */
export async function getUserInfo(options?: { [key: string]: any }) {
  return request<UserAPI.PlainResultUserInfo>("/user/getUserInfo", {
    method: "GET",
    ...(options || {})
  });
}

/** 此处后端没有提供注释 POST /user/login */
export async function login(body: UserAPI.LoginUserParam, options?: { [key: string]: any }) {
  return request<UserAPI.PlainResultLoginResult>("/user/login", {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    data: body,
    ...(options || {})
  });
}

/** 此处后端没有提供注释 GET /user/logout */
export async function logout(options?: { [key: string]: any }) {
  return request<UserAPI.BaseResult>("/user/logout", {
    method: "GET",
    ...(options || {})
  });
}
